<?php
namespace AuctionCore\CarDealer;
use Think\Exception;

/**
* 列表 单元测试
* @author       Eric Lee
*/
class DealerListTest extends \PHPUnit_Framework_TestCase {

    


    //买到的车
    public function testBuyCarList(){        
        $list = new \AuctionCore\CarDealer\BuyCarList(3);
        $cond = 'WHERE ';
        $cond .= 'c.model_id IN (27030) '; //车型
        $cond .= "AND t.trade_time BETWEEN '2015-12-10 00:00:00' AND '2015-12-10 23:59:59'"; //成交时间 
        $cond .= "AND t.deliver_type=1 "; //交付方式
        $cond .= "AND t.pay_type=1  ";    //支付方式 
        //$cond .= "AND t.status=6 ";
        $list->condition = $cond;  
        $l = $list->get(200,1);  //获得分页数据,200 是每页条数,1 是页码
        
        $this->assertTrue(count($l)>0);
        $c = $list->count();   //获得总数;
        $this->assertTrue(intval($c)>0);
    }

    public function testBidCarList(){
        $list = new \AuctionCore\CarDealer\BidCarList(22);   
        $cond = ' AND ';
        $cond .= 'model_id IN (27030) '; //车型
        $cond .= "AND trade_time BETWEEN '2015-12-10 00:00:00' AND '2015-12-10 23:59:59'"; //成交时间 
        $cond .= "AND deliver_type=1 "; //交付方式
        $cond .= "AND pay_type=1  ";    //支付方式 
        $list->condition = $cond;          
        $l = $list->get(200,1);        //获得分页数据,200 是每页条数,1 是页码
        $this->assertTrue(count($l)>0);
        $c = $list->count();                //获得总数;
        $this->assertTrue(count($c)>0);
    }

    public function testDealerUserList(){
        $list = new DealerUserList();
        $list->condition = ' where contact_person=\'张小小\'';
        $list->get(2,1);
        $list->count();

    }

    //保证金列表
    public function testBailList(){
        $list = new BailList();
        //$list->condition = ' where d.dealer_id = 62 ';
        $l = $list->get(20,1);
        $c = $list->count();
        $this->assertTrue(count($l)>0);
    }

    //待收车商车款拍单列表
    public function testWaitCollectMoneyList(){
        $w_coll = new \AuctionCore\CarDealer\WaitCollectMoneyList();
        //收款列表
        $search_key = '';
        if($search_key){
            $w_coll .=" d.dealer_id='{$search_key}' or d.contact_mobile='{$search_key}' or d.contact_person ='{$search_key}' ";
        }
        $l = $w_coll->get(10,1);

       
        dump($l);exit;
    }

    //待付车主车款拍单列表
    public function testWaitPayMoney(){
         $w_coll = new \AuctionCore\CarDealer\WaitPayMoneyList();
        //待付款列表
        $search_key = '';
        if($search_key){
            $w_coll .=" d.dealer_id='{$search_key}' or d.contact_mobile='{$search_key}' or d.contact_person ='{$search_key}' ";
        }
        $l = $w_coll->get(10,1);

       
        dump($l);exit;
    }
}